package com.junzhiit.nengji.shop.model.enums;

import com.bainaeco.framework.exception.InvalidArgumentException;

public enum MemberCardType {
	ZERO_LEVEL(0,"无门槛"),
	ONE_LEVEL(1,"按规则发放"),
	TWO_LEVEL(2,"用户购买");
	
	private Integer value;
	private String text;

	private MemberCardType(Integer value,String text) {
		this.value = value;
		this.text = text;
	}

	public Integer toIntValue() {
		return this.value;
	}
	
	public String toStringText() {
		return this.text;
	}

	public static MemberCardType toGrade(Integer value) {
		if (ZERO_LEVEL.value == value) {
			return ZERO_LEVEL;
		} else if (ONE_LEVEL.value == value) {
			return ONE_LEVEL;
		}else if (TWO_LEVEL.value == value) {
			return TWO_LEVEL;
		}else {
			throw new InvalidArgumentException("Unknown MemberCardType[" + value + "].");
		}
	}
}
